// 定义 sendMessage 的类型
type SendMessage = (_channel: string, _data: unknown) => void

// 定义 onMessage 的类型
type OnMessage = (_channel: string, _callback: (..._args) => void) => () => void

// 定义 useDark 的类型
type UseDark = (_isDark: boolean) => void

// 定义 quit 的类型
type Quit = () => void

// 定义 restart 的类型
type Restart = () => void

// 定义 getSystemInfo 的类型
type GetSystemInfo = () => Promise<unknown>

// 定义 setConfig 的类型
type SetConfig = (_config: string, _type?: string) => Promise<void>

// 定义 getConfig 的类型
type GetConfig = (_type?: string) => Promise<unknown>

// 定义 startServer 的类型
type StartServer = () => Promise<unknown>

// 定义 stopServer 的类型
type StopServer = () => Promise<unknown>

type RestartServer = () => Promise<unknown>

type IsAutoLaunchEnabled = () => Promise<boolean>

type SetAutoLaunch = () => Promise<unknown>

type UnsetAutoLaunch = () => Promise<unknown>

// 定义 app 对象的类型
interface App {
  sendMessage: SendMessage
  onMessage: OnMessage
  useDark: UseDark
  quit: Quit
  restart: Restart
  getSystemInfo: GetSystemInfo
  setConfig: SetConfig
  getConfig: GetConfig
  startServer: StartServer
  stopServer: StopServer
  restartServer: RestartServer
  isAutoLaunchEnabled: IsAutoLaunchEnabled
  setAutoLaunch: SetAutoLaunch
  unsetAutoLaunch: UnsetAutoLaunch
}

export type {
  App,
  SendMessage,
  OnMessage,
  UseDark,
  Quit,
  Restart,
  GetSystemInfo,
  SetConfig,
  GetConfig,
  StartServer,
  StopServer,
  RestartServer,
  IsAutoLaunchEnabled,
  SetAutoLaunch,
  UnsetAutoLaunch
}
